import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

//按需导入：路由统一使用了懒加载模式，减少资源浪费
const routes = [
  //一级路由，登入注册界面
  { path: '/', component: () => import('@/views/login') },
  {
    //若打开网址为layout首页架子，重定向
    path: '/layout',
    //重定向到管理界面的数据看板
    redirect: '/board',
    component: () => import('@/views/layout'), // 布局
    //二级路由
    children: [
      // 数据看板
      { path: '/board', component: () => import('@/views/board') },
      //人员信息
      { path: '/person', component: () => import('@/views/personnelInfo/index.vue') },
      // 医生信息页面
      { path: '/doctor', component: () => import('@/views/personnelInfo/doctor/index.vue') },
      // 患者信息页面
      { path: '/patient', component: () => import('@/views/personnelInfo/patient/index.vue') },
      //护士信息页面
      { path: '/nurse', component: () => import('@/views/personnelInfo/nurse/index.vue') },
      // 病房信息管理页面
      { path: '/sickroom', component: () => import('@/views/sickroom') },
      // 药品信息管理页面
      { path: '/medicine', component: () => import('@/views/medicine') },
      //费用管理页面
      { path: '/expense', component: () => import('@/views/expense') },
    ]
  }

]

const router = new VueRouter({
  mode: 'history',  //历史模式
  base: process.env.BASE_URL,
  routes
})

export default router
